Conversation
As in ``` \models\User::findByEmail(); $post->toJSON(); ```
|
Needs tests. And why would anyone use the camelCased version of methods, when that in the end performs worse (not sure, only assuming that passing a method call to |
There was a problem hiding this comment.
Why even have this method_exists() check block?
This won't allow for the build or create methods and this __call method already handles the error case if a method doesn't exist.
There was a problem hiding this comment.
Same goes for the static version above.
|
Everything works as before: the only addon feature is that a call to a nonexistent method: findAllByCategory will be translated to a call to: find_all_by_category
....nothing fancy, just allowing cameCase method calls "And why would anyone use the camelCased version of methods" i just find camelCase more readable (and modern). You don't call finders 1000 times per request, I hope no one even call them 100 times per request, so performance will not be affected even if call_user_func_array is slower. also any magic method call is slower than callign an existing method, but that is how php-activerecord magic finders are implemented. Again the numer of calls per request make this negligible. kindly |
|
I understand what it does, but to verify the functionality, and to be sure that it won't break in the future there need to be tests |
|
I think a lot of developers are switching over to this convention and it would be nice to allow it in the finders. I agree that performance impact would be trivial if any from method_exist lookups. Could you include a test which includes using your camelCased finders if you want us to merge this in. |
As in